/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package IO;
import Configuration.*;
/**
 *
 * @author Randy
 * Checks if the application 
 */
public class ApplicationResourcesCheck {
    private ResourceLocationHelper resourceHelper = new ResourceLocationHelper();
    ///checks if the folder "Escenarios" exist
    public void CheckEscenariosFolder() throws ResourceNotFoundException {
        if (!resourceHelper.folderExist("Escenarios"))
            throw new ResourceNotFoundException("El folder de escenarios no existe.");
    }
    ///checks if exist the folder "Personajes" exist
    public void CheckPersonajesFolder() throws ResourceNotFoundException {
        if (!resourceHelper.folderExist("Personajes"))
            throw new ResourceNotFoundException("El folder de Personajes no existe.");
    }
    ///checks if exists the folder "Audios" exist
    public void CheckAudiosFolder() throws ResourceNotFoundException {
        if (!resourceHelper.folderExist("Audios"))
            throw new ResourceNotFoundException("El folder de Audios no existe.");
    }
    ///Check if the folder "Escenarios" contains at least one image
    public void CheckEscenariosImages() throws ResourceNotFoundException {
        if (resourceHelper.folderHasExtensionMatchFiles("Escenarios", "png")==0)
            throw new ResourceNotFoundException("El folder Escenarios debe tener al menos una imagen");
    }
    ///Check if the folder "Personajes" contains at least one folder with the following prefix P_
    public void CheckPersonajesFolders() throws InvalidFolderException {
        if (resourceHelper.folderHasPrefixMatchContent("Personajes", "P-")==0)
            throw new InvalidFolderException("El folder Personajes debe tener una carpeta con algun personaje");
    }
    ///Check if the folder "Audios" contains at least one file with the extension ".ogg"
    public void CheckAudioFiles() throws ResourceNotFoundException {
        if (resourceHelper.folderHasExtensionMatchFiles("Audios", "ogg")==0)
            throw new ResourceNotFoundException("El folder Audios debe tener al menos un archivo de audio");
    }
    
    public void CheckPersonajesFoldersContent() throws ResourceNotFoundException {
        ///get the list of the folders inside personajes folder
        if (resourceHelper.CheckContentFolderChildsPersonajes("Personajes", "png")==0)
            throw new ResourceNotFoundException("Algun folder de personajes debe tener al menos una imagen ");
    }
    
    public void MasterFolderExists() throws ResourceNotFoundException {
        if (!resourceHelper.folderExist(""))
            throw new ResourceNotFoundException("El folder maestro debe existir "+Configuration.MasterFolder);
    }
}
